#include <bits/stdc++.h>
using namespace std;

bool issame(string a, string b)
{
    map<char, int> ma, mb;
    for (auto e : a) ma[e]++;
    for (auto e : b) mb[e]++;
    for (char i = 'a'; i <= 'z'; i++)
    {
        if (ma[i] && mb[i])
            return true;
    }
    return false;
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<string> s(n);
        char c;
        for (int i = 0; i < n; i++)
            cin >> s[i];
        if (n == 1) goto th;
        else
        {
            int left = 0, right = n - 1;
            while (left < right)
            {
                if (issame(s[left], s[right]))
                {
                    left++;
                    right--;
                }
                else
                {
                    cout << "No" << endl;
                    goto ret;
                }
            }
        }
    th:
        cout << "Yes" << endl;
    ret:
        continue;
    }
}